package com.screen.screendisplay.service.impl.dryport;

import com.screen.screendisplay.entity.dryport.DryportProdoperFluxPlan;
import com.screen.screendisplay.mapper.dryport.DryportProdoperFluxPlanMapper;
import com.screen.screendisplay.service.dryport.DryportProdoperFluxPlanService;
import com.screen.screendisplay.vo.dryport.FluxPlanVO;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.beans.BeanUtils;
import org.springframework.stereotype.Service;

import java.util.List;
import java.util.stream.Collectors;

/**
 * <p>
 * 引流计划表 服务实现类
 * </p>
 *
 * @author xuesong
 * @since 2025-08-23
 */
@Service
public class DryportProdoperFluxPlanServiceImpl extends ServiceImpl<DryportProdoperFluxPlanMapper, DryportProdoperFluxPlan> implements DryportProdoperFluxPlanService {

    @Override
    public List<FluxPlanVO> getMonthlyStatsByYearAndType(Integer year, Integer type) {
        // 从数据库查询数据
        List<DryportProdoperFluxPlan> entityList = baseMapper.getMonthlyStatsByYearAndType(year, type);
        
        // 转换为VO对象
        return entityList.stream().map(entity -> {
            FluxPlanVO vo = new FluxPlanVO();
            BeanUtils.copyProperties(entity, vo);
            return vo;
        }).collect(Collectors.toList());
    }

}
